import { GET_BUSINESS_LEVEL_SELECT, GET_PRODUCT_LIST } from '../../constants/ActionTypes'
// import { combineReducers } from 'redux'


const initialState = {
    businessLevelSelect: [],
    productList:[],
    productListTotal:0,    
    createState:false,
}


const createCouponReducer = (state = initialState, action) =>{ 
    switch (action.type){
        case GET_BUSINESS_LEVEL_SELECT: 
            return Object.assign({},state,{businessLevelSelect:action.businessLevelSelect})
        case GET_PRODUCT_LIST: 
            let obj = {};
            obj.productList = action.productList?action.productList:[];
            obj.productListTotal = action.productListTotal?action.productListTotal:0;
            return Object.assign({},state,obj);              
        default:
            return {...state}
   }
}
export const getBusinessLevelSelect = state => state.businessLevelSelect

export const getProductList = state => state.productList

export const getProductListTotal = state => state.productListTotal


// export const getBusinessLevelSelect = (state) =>(
//     initialState.businessLevelSelect
// )


export default createCouponReducer
